﻿using System;

namespace CometDocs
{
    /// <summary>
    /// Represents an Exception raised by the CometDocs API.
    /// </summary>
    public class CometDocsException : Exception
    {
        /// <summary>
        /// The corresponding Response message.
        /// </summary>
        public new string Message { get; private set; }

        /// <summary>
        /// The corresponding Response message.
        /// </summary>
        public Status Status { get; private set; }

        /// <summary>
        /// The corresponding Response error message.
        /// </summary>
        public string Error { get; private set; }

        /// <summary>
        /// Create a new instance of CometDocsException using the error data sent by the CometDocs web API.
        /// </summary>
        /// <param name="message"></param>
        /// <param name="status"></param>
        /// <param name="error"></param>
        public CometDocsException(string message, Status status, string error)
            : base(string.Format("{0} ({1}) [{2}]", message, error, status))
        {
            Message = message;
            Status = status;
            Error = error;
        }
    }
}
